<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    body {
        padding: 50px;
        transform-style: preserve-3d;
        font-size: 30px;
    }
    
    .mydiv {
        height: 50x;
        width: 100px;
        border: 1px solid #ccc;
        margin-bottom: 20px;
        display: inline-block;
    }
    
    .case1 {
        transform: perspective(.5em) rotateX(5deg);
    }
    
    .case2 {
        position: relative;
        display: inline-block;
        padding: .5em 1em .35em;
        color: white;
    }
    
    .case2::before {
        content: '';
        /* 用伪元素来生成一个矩形 */
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: -1;
        background: #58a;
        transform: perspective(.5em) rotateX(5deg);
    }
    /* 为了让它的尺寸更好掌握，我们可以为它指定transform-origin:
bottom;，当它在3D 空间中旋转时，可以把它的底边固定住。 */
    
    .case3 {
        position: relative;
        display: inline-block;
        padding: .5em 1em .35em;
        color: white;
    }
    
    .case3::before {
        content: '';
        /* 用伪元素来生成一个矩形 */
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: -1;
        background: #58a;
        transform: scaleY(1.3) perspective(.5em) rotateX(5deg);
        transform-origin: bottom;
    }
    
    nav>a {
        position: relative;
        display: inline-block;
        padding: .3em 1em 0;
    }
    
    nav>a::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: -1;
        background: #ccc;
        background-image: linear-gradient( hsla(0, 0%, 100%, .6), hsla(0, 0%, 100%, 0));
        border: 1px solid rgba(0, 0, 0, .4);
        border-bottom: none;
        border-radius: .5em .5em 0 0;
        box-shadow: 0 .15em white inset;
        transform: perspective(.5em) rotateX(5deg);
        transform-origin: bottom;
    }
    /* 只要改变transform-origin 就
可以得到单侧倾斜的标签页 */
</style>

<body>
    <div class="mydiv case1">dddd</div>
    <div class="mydiv case2">dddd</div>
    <div class="mydiv case3">dddd</div>
    <nav>
        <a href="">xxx</a><a href="">xxx</a><a href="">xxx</a>


    </nav>
</body>

</html>